<script setup>
import { defineProps } from 'vue';
const props = defineProps({
  userName: String,
  payInfo: Object
});
</script>

<template>
  <div class="pay-left-cart">
    <div class="user-nick">{{ $t('greeting') }}<span>{{ userName }}</span></div>
    <div class="cart-info">
      <h2 class="cart-title">{{ $t("payCart") }}</h2>
      <ul class="cart-list">
        <li v-for="item in payInfo.items" :key="item.id">
          {{ $t(`package${item.id}`) }} <span class="cart-price">￥{{ item.price }}</span>
        </li>
      </ul>
      <div class="cart-total">{{ $t("pay") }}: <span>￥{{ payInfo.total }}</span></div>
    </div>
    <div class="pay-tip">{{ $t("payTip2") }}</div>
  </div>
</template>

<style scoped>
.pay-left-cart {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--card-bg);
  border-radius: 16px;
  min-width: 320px;
  padding: 20px;
}
.user-nick {
  font-size: 1.1rem;
  color: var(--h4-color);
  font-weight: 600;
  margin-bottom: 18px;
}
.cart-info {
  width: 100%;
  margin-bottom: 18px;
}
.cart-title {
  font-size: 1.3rem;
  color: #4facfe;
  margin-bottom: 10px;
  font-weight: bold;
}
.cart-list {
  margin: 0 0 16px 0;
  padding: 0 0 0 18px;
  color: var(--pay-tx);
  font-size: 1rem;
}
.cart-list li {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.cart-price {
  color: #e67e22;
  font-weight: 600;
}
.cart-total {
  font-size: 1.1rem;
  color: var(--h4-color);
  margin-bottom: 8px;
}
.cart-total span {
  color: #e67e22;
  font-weight: bold;
  font-size: 1.2rem;
}
.pay-tip {
  margin-top: 18px;
  color: #888;
  font-size: 0.98rem;
  border-top: 1px dashed #eee;
  padding-top: 12px;
  width: 100%;
  text-align: center;
}
</style>